<template>
    <div class="Box">
        <router-link class="imgBox"  :to="{ name:'video',query:{ avid:props.aid, bvid:props.bvid, cid:props.cid} }" target="_blank">
            <img :src="props.pic"/>
            <span>{{ voideoAllTime(props.duration) }}</span>
        </router-link>
        <div class="infoBox">
            <router-link :to="{ name:'video',query:{ avid:props.aid, bvid:props.bvid, cid:props.cid} }" @click="goOtherVideo">{{ props.title }}</router-link>
            <p>
                <img src="@/assets/videoCardIcon/UP.png"/>
                <span>{{ props.owner.name }}</span>
            </p>
            <p>
                <span>
                    <img src="@/assets/videoIcon/PlayBlack.png" >
                    {{ formatNum(props.stat.view) }}
                </span>
                <span>
                    <img src="@/assets/videoIcon/danmaku.png" >
                    {{ formatNum(props.stat.danmaku) }}
                </span>
            </p>
        </div>
    </div>
</template>

<script lang="ts" setup>
import { info } from './typeInterface'
import { formatNum,formatTime,voideoAllTime } from '@/utils/format'
interface Props extends info{

}
const props = defineProps<Props>()
function goOtherVideo() {
    let timer = setTimeout(() => {
        clearTimeout(timer)
        location.reload()
    })

}
</script>

<style lang="scss" scoped>
@media  screen and (min-width: 0) and (max-width: 1600px){
    .Box{
        height: 82px;
    }
}
@media  screen and (min-width: 1600px) and (max-width: 2000px){
    .Box{
        height: 90px;
    }
}
p{
    padding: 0;
    margin: 0;
}
.Box{
    width: 100%;
    display: flex;
}
.imgBox{
    width: 40%;
    height: 100%;
    position: relative;
    & img{
        border-radius: 4px;
        width: 100%;
        height: 100%;
    }
    & span:nth-child(2){
        position: absolute;
        right: 10px;
        bottom: 10px;
        color: white;
        font-size: 12px;
        border-radius: 4px;
        padding: 0 5px;
        background-color: rgb(0, 0, 0,0.6);
    }
}
.infoBox{
    margin-left: 10px;
    width: 60%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: start;
    text-align: left;
    & a:nth-child(1){
        width: 100%;
        font-size: 15px;
        color: #18191C;
        line-height: 18px;
        max-height: 36px;
        @include tweLineShow;
    }
    & a:nth-child(1):hover{
        color: #008AC5;
    }
    & p:nth-child(2){
        margin-top: 5px;
        width: 100%;
        display: flex;
        justify-content: start;
        align-items: center;
        font-size: 13px;
        color: #9499A0;
        cursor: pointer;
    }
    & p:nth-child(2):hover{
        color: #008AC5;
    }
    & p:nth-child(2) img{
        width: 16px;
        height: 16px;
        margin-right: 5px;
    }
    & p:nth-child(3){
        width: 100%;
        display: flex;
        justify-content: start;
        align-items: center;
    }
    & p:nth-child(3) span{
        width: 100%;
        display: flex;
        justify-content: start;
        align-items: center;
        font-size: 13px;
        color: #9499A0;
    }
    & p:nth-child(3) span:nth-child(1) img:nth-child(1){
        width: 15px;
        height: 15px;
        margin-right: 5px;
    }
    & p:nth-child(3)  span:nth-child(2) img:nth-child(1){
        width: 20px;
        height: 22px;
        margin-right: 5px;
    }
}
</style>